﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;

namespace ABELGX
{
    /// <summary>
    /// PageMotor.xaml 的交互逻辑
    /// </summary>
    public partial class PageMotor : Page
    {
        public Car Car { get;private set; }
        public PageMotor()
        {
            InitializeComponent();
        }
        public void SetCar(Car car)
        {
            Car = car;
            if (Car == null)
            {
                return;
            }
            MotorAcc.SetSensor(Car.InfoMotor.Acc);
            MotorRpm.SetSensor(Car.InfoMotor.Rpm);
            MotorWaterTemperature.SetSensor(Car.InfoMotor.WaterTemperature);
            MotorOilLevel.SetSensor(Car.InfoMotor.OilLevel);
            MotorOilTemperature.SetSensor(Car.InfoMotor.OilTemperature);
            MotorAirTemperature.SetSensor(Car.InfoMotor.AirTemperature);
            MotorHours.SetSensor(Car.InfoMotor.Hours);

            new ButtonVM(MotorOn, ButtonVMType.Press, Car.CmdCommon.MotorOn, Car.InfoCommon.MotorOn);
            new ButtonVM(MotorOff, ButtonVMType.Press, Car.CmdCommon.MotorOff,Car.InfoCommon.MotorOff);
            new ButtonVM(AccUp, ButtonVMType.Press, Car.CmdCommon.AccUp, Car.InfoCommon.AccUp);
            new ButtonVM(AccDown, ButtonVMType.Press, Car.CmdCommon.AccDown, Car.InfoCommon.AccDown);
            new ButtonVM(Custom11, ButtonVMType.Press, Car.CmdCommon.Customize[10], Car.InfoCommon.Customize[10]);
            new ButtonVM(Custom12, ButtonVMType.Press, Car.CmdCommon.Customize[11], Car.InfoCommon.Customize[11]);
        }
    }
}
